<?php

namespace App\Api\Requests;

class LoginRequest extends BaseRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'mobile'   => [
                'bail',
                'required',
                'digits:11',
                'exists:users,mobile',
            ],
            'password' => [
                'bail',
                'required',
                'between:6,20',
                'password',
            ],
        ];
    }

    public function messages()
    {
        return [
            'mobile.required'   => '手機號碼字段缺失',
            'mobile.digits'     => '手機號碼格式錯誤',
            'mobile.exists'     => '手機號碼錯誤',
            'password.required' => '密碼字段缺失',
            'password.password' => '密碼格式錯誤',
            'password.between'  => '密碼長度應在6-20個字符',
        ];
    }
}
